<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>11_时间对象</title>
    </head>
    <body>
        <script>
            var date = new Date();

            console.log(date);

            // 年
            var year = date.getFullYear();
            console.log(year);

            // 月  
            var month = date.getMonth() + 1;
            console.log(month);

            // 日
            var day = date.getDate();
            console.log(day);

            // 时
            var hour = date.getHours();

            console.log(hour);

            // 分
            var minutes = date.getMinutes();
            console.log(minutes);

            // 秒
            var seconds = date.getSeconds();
            console.log(seconds);

            var time = date.toLocaleDateString();
            console.log(time);

            var time1 = date.toLocaleTimeString();
            console.log(time1);

            
        </script>
    </body>
</html>